Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Log files not persisted on container restart #10738

Closed
2 tasks done
Erasure5959 opened this issue May 18, 2024 · 2 comments
Closed
2 tasks done

Log files not persisted on container restart #10738

Erasure5959 opened this issue May 18, 2024 · 2 comments
Assignees
Labels
kind/bug/confirmed a confirmed bug (reproducible).
Milestone

Comments

@Erasure5959
Copy link

Welcome!

  • Yes, I've searched similar issues on GitHub and didn't find any.
  • Yes, I've searched similar issues on the Traefik community forum and didn't find any.

What did you do?

The defined log files (traefik.log and access.log) on the host are wiped and start afresh when the container is restarted. This behaviour seems to be specific to v3 as it does not seem to be present on v2 with the same configuration.

What did you see instead?

Logs should remain if the container restarts - file should be appended.

What version of Traefik are you using?

Version: 3.0.0
Codename: beaufort
Go version: go1.22.2
Built: 2024-04-29T14:25:59Z
OS/Arch: linux/amd64

What is your environment & configuration?

  traefik:
    container_name: "traefik"
    image: "traefik:latest"
    restart: "unless-stopped"
    depends_on:
      - cetusguard
    networks:
      - "cetusguard"
      - "traefik"
    healthcheck:
    # Run traefik healthcheck command
    # https://doc.traefik.io/traefik/operations/cli/#healthcheck
      test: ["CMD", "traefik", "healthcheck", "--ping"]
      interval: 10s
      timeout: 5s
      retries: 3
      start_period: 5s
    ports:
      # To be able to listen on port 80 (http)
      - mode: host
        published: 80
        target: 80
        protocol: tcp
      # To be able to listen on port 443 (https)
      - mode: host
        published: 443
        target: 443
        protocol: tcp
      # To enable HTTP/3 (QUIC)
      - mode: host
        published: 443
        target: 443
        protocol: udp
    security_opt:
      - no-new-privileges:true
    cap_drop:
      - ALL
    secrets:
      - do_auth_token
    environment:
      - DO_AUTH_TOKEN_FILE=/run/secrets/do_auth_token
    volumes:
      - type: bind
        source: /etc/localtime
        target: /etc/localtime
        read_only: true
      - type: bind                                                    # Location of data folder
        source: /etc/traefik/data
        target: /data
      - type: bind
        source: /var/log/traefik
        target: /var/log/traefik
      - type: bind                                                    # Location to write certificates to
        source: /etc/traefik/acme/acme.json
        target: /acme.json
      - type: bind
        source: /etc/traefik/traefik.yml                              # Static Traefik Configuration
        target: /etc/traefik/traefik.yml
        read_only: true
      - type: bind
        source: /etc/traefik/conf.d
        target: /etc/traefik/conf.d
        read_only: true

traefik.yml

log:
  filePath: "/var/log/traefik/traefik.log"
  level: DEBUG
  maxBackups: 5

accessLog:
  filePath: "/var/log/traefik/access.log"
  bufferingSize: 20
  filters:
    statusCodes:
      - "204-299"
      - "400-499"
      - "500-599"
    retryAttempts: true

If applicable, please paste the log output in DEBUG level

No response

@lbenguigui lbenguigui added kind/bug/possible a possible bug that needs analysis before it is confirmed or fixed. and removed status/0-needs-triage labels May 23, 2024
@lbenguigui lbenguigui self-assigned this May 23, 2024
@lbenguigui
Copy link
Contributor

Hello @Erasure5959 ,

Thank you for your interest in Traefik.

I have submitted a PR that updates the behavior to be consistent with version 2.

@lbenguigui lbenguigui added kind/bug/confirmed a confirmed bug (reproducible). and removed kind/bug/possible a possible bug that needs analysis before it is confirmed or fixed. labels May 24, 2024
@traefiker traefiker added this to the 3.0 milestone May 24, 2024
@traefiker
Copy link
Contributor

Closed by #10756.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug/confirmed a confirmed bug (reproducible).
Projects
None yet
Development

No branches or pull requests

3 participants